package com.wwl.cms.utils.designModeTest.memento.theory;

import java.util.ArrayList;
import java.util.List;

/**
 * @author wwl
 * @version 1.0
 * @date 2021/9/26 18:13
 * @description:
 */
public class Caretaker {
    //在List集合中会有很多的备忘录对象
    private List<Memento> mementoList = new ArrayList<Memento>();

    public void add(Memento memento){
        mementoList.add(memento);
    }

    //获取到第index个Orginator的备忘录对象(即保存状态)
    public Memento get(int index){
        return mementoList.get(index);
    }
}
